package casia.isiteam.springbootshiro.properties.other;

import casia.isiteam.datagroup.es.operation.search.EsIndexSearch;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * Created by casia.wzy on 2018/2/8.
 */
@Component
@Configuration
@ConfigurationProperties(prefix = "es")
public class IndexConfig {
    private static String IndexCore;

    public static String getIndexCore() {
        return IndexCore;
    }

    public void setIndexCore(String indexCore) {
        IndexCore = indexCore;
    }

    /**
     * 生成索引实例
     * @param prefixs
     * @return
     */
    public static EsIndexSearch getEsIndexSearch(String indexname, String prefixs){
        EsIndexSearch searchClient = new EsIndexSearch(getIndexCore(), indexname, prefixs);
        return searchClient;
    }
}
